package com.lyhengtongwl.zqsnews.ui.activity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lyhengtongwl.zqsnews.App;
import com.lyhengtongwl.zqsnews.R;
import com.lyhengtongwl.zqsnews.base.BaseActivity;
import com.lyhengtongwl.zqsnews.net.UpClickCount;
import com.lyhengtongwl.zqsnews.utils.AppConfig;
import com.lyhengtongwl.zqsnews.utils.ScreenUtil;
import com.lyhengtongwl.zqsnews.utils.SystemUtils;
import com.lyhengtongwl.zqsnews.utils.TitleBuilder;
import com.lyhengtongwl.zqsnews.widget.CenterDialog;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.OnClick;


public class NewsSettingActivity extends BaseActivity {
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.tv_bb)
    TextView tv_bb;
    @Override
    public void setListen() {

    }

    @Override
    protected boolean isStatusBarBlack() {
        return true;
    }

    @OnClick({R.id.rel_pp, R.id.rel_connectM,
            R.id.rl_about, R.id.rel_logOut, R.id.rel_info,R.id.rel_userP,R.id.rel_clearCathe})
    public void onViewClicked(View view) {
        if (ScreenUtil.isFastClick()) {
            return;
        }
        switch (view.getId()) {
            case R.id.rel_userP://用户协议
                UpClickCount.getInstance(this).upClick("agreement","用户协议");
                startActivity(new Intent(NewsSettingActivity.this, NewsWebCommonActivity.class).putExtra("url", AppConfig.getInstance(App.getContext()).get("userUrl")));
                break;
            case R.id.rel_pp://隐私协议
                UpClickCount.getInstance(this).upClick("policy","隐私政策");
                startActivity(new Intent(NewsSettingActivity.this, NewsWebCommonActivity.class).putExtra("url", AppConfig.getInstance(App.getContext()).get("privacyUrl")));
                break;
            case R.id.rel_connectM://联系我们
                UpClickCount.getInstance(this).upClick("contactUs","联系我们");
                startActivity(new Intent(NewsSettingActivity.this, ConectUsActivity.class));
                break;
            case R.id.rel_info://个人资料
                startActivity(new Intent(NewsSettingActivity.this, NewsMineInfoActivity.class));
                break;
            case R.id.rl_about://关于
                break;
            case R.id.rel_logOut://退出登录
                new CenterDialog(R.layout.prompt_dialog, NewsSettingActivity.this).showPrompt("确认退出？");
                break;
            case R.id.rel_clearCathe://清楚缓存
                new CenterDialog(R.layout.prompt_dialog, NewsSettingActivity.this).clearMemory("确定清楚缓存？");
                break;
        }
    }

    @Override
    public void setTitleBarColor() {
        ivTitleRight.setVisibility(View.GONE);
        new TitleBuilder(this).setTitleText("设置")
                .setLeftIcoListening(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        finish();
                    }
                });
    }

    @Override
    public int intiLayout() {
        return R.layout.activity_new_setting;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void initView() {
        tv_bb.setText("版本号 "+ SystemUtils.getLocalVersionName(this));
    }

    @Override
    public void initData() {

    }
}
